package com.bootdo.system.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;
import java.util.Map;

import com.bootdo.system.dao.BpostionDao;
import com.bootdo.system.domain.BpostionDO;
import com.bootdo.system.service.BpostionService;



@Service
public class BpostionServiceImpl implements BpostionService {
	@Autowired
	private BpostionDao bpostionDao;
	
	@Override
	public BpostionDO get(Long id){
		return bpostionDao.get(id);
	}
	
	@Override
	public List<BpostionDO> list(Map<String, Object> map){
		return bpostionDao.list(map);
	}
	
	@Override
	public int count(Map<String, Object> map){
		return bpostionDao.count(map);
	}
	
	@Override
	public int save(BpostionDO bpostion){
		bpostion.setCreated(new Date());
		bpostion.setRecomondStatus(0);
		return bpostionDao.save(bpostion);
	}
	
	@Override
	public int update(BpostionDO bpostion){
		return bpostionDao.update(bpostion);
	}
	
	@Override
	public int remove(Long id){
		return bpostionDao.remove(id);
	}
	
	@Override
	public int batchRemove(Long[] ids){
		return bpostionDao.batchRemove(ids);
	}

	@Override
	public boolean updateStatusById(Long id, Integer recomondStatus) {
		BpostionDO bpostion = new BpostionDO();
		bpostion.setId(id);
		bpostion.setRecomondStatus(recomondStatus);
		bpostion.setUpdated(new Date());
		return  bpostionDao.update(bpostion)>0;


	}

}
